/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package GUI;

import com.sun.awt.AWTUtilities;
import javax.swing.JProgressBar;

/**
 *
 * @author Freddy Aparicio, Ronald Melo
 */
public final class VentanaPresentacion extends javax.swing.JFrame {
    
    /**
     * Creates new form VentanaPrincipal
     */
    CargarBarra hilo;
    double iniciodeDesvanecimiento=60, aumentoDesvanecimiento=1;
   
    public VentanaPresentacion() {
        initComponents();
        iniciar();
    }
    
     public void iniciar(){
        setLocationRelativeTo(null);
        hilo= new CargarBarra(getJBBarraDeProgreso());
        hilo.start();
        hilo=null;
    }

  
     
     

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        JBBarraDeProgreso = new javax.swing.JProgressBar();
        JLTituloAplicacion = new javax.swing.JLabel();
        jLabel1 = new javax.swing.JLabel();
        jLabel2 = new javax.swing.JLabel();
        JLFondoPresentacion = new javax.swing.JLabel();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setUndecorated(true);
        getContentPane().setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());

        JBBarraDeProgreso.addChangeListener(new javax.swing.event.ChangeListener() {
            public void stateChanged(javax.swing.event.ChangeEvent evt) {
                JBBarraDeProgresoStateChanged(evt);
            }
        });
        getContentPane().add(JBBarraDeProgreso, new org.netbeans.lib.awtextra.AbsoluteConstraints(190, 80, 180, 20));

        JLTituloAplicacion.setFont(new java.awt.Font("Segoe UI", 1, 48)); // NOI18N
        JLTituloAplicacion.setForeground(new java.awt.Color(255, 0, 0));
        JLTituloAplicacion.setText("OPAC");
        getContentPane().add(JLTituloAplicacion, new org.netbeans.lib.awtextra.AbsoluteConstraints(190, 10, -1, -1));

        jLabel1.setFont(new java.awt.Font("Segoe UI", 1, 18)); // NOI18N
        jLabel1.setForeground(new java.awt.Color(204, 0, 0));
        jLabel1.setText("SIDINSOFT");
        getContentPane().add(jLabel1, new org.netbeans.lib.awtextra.AbsoluteConstraints(50, 190, -1, -1));

        jLabel2.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Imagenes/EscudoSidinsoft.jpg"))); // NOI18N
        getContentPane().add(jLabel2, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 20, 160, 170));

        JLFondoPresentacion.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Imagenes/IMPrsentacion.jpg"))); // NOI18N
        getContentPane().add(JLFondoPresentacion, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 0, -1, 500));

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void JBBarraDeProgresoStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_JBBarraDeProgresoStateChanged
        if (JBBarraDeProgreso.getValue()==iniciodeDesvanecimiento){
           
            if(aumentoDesvanecimiento!=101){
            AWTUtilities.setWindowOpacity(this, Float.valueOf((100-aumentoDesvanecimiento)/100+"f"));
            iniciodeDesvanecimiento++;
            aumentoDesvanecimiento+=2;
            }
        }
        if (JBBarraDeProgreso.getValue()==100){
            VentanaInicioSesion nuevaviniciosesion = new VentanaInicioSesion();
            nuevaviniciosesion.setVisible(true);
            this.dispose();
        }
    }//GEN-LAST:event_JBBarraDeProgresoStateChanged

    
      
    
      
    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        /* Set the Nimbus look and feel */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
         * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 
         */
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(VentanaPresentacion.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(VentanaPresentacion.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(VentanaPresentacion.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(VentanaPresentacion.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>
        //</editor-fold>
        //</editor-fold>
        //</editor-fold>

        /* Create and display the form */
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new VentanaPresentacion().setVisible(true);
            }
        });
    }

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JProgressBar JBBarraDeProgreso;
    private javax.swing.JLabel JLFondoPresentacion;
    private javax.swing.JLabel JLTituloAplicacion;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel2;
    // End of variables declaration//GEN-END:variables

    /**
     * @return the JBBarraDeProgreso
     */
    public javax.swing.JProgressBar getJBBarraDeProgreso() {
        return JBBarraDeProgreso;
    }

    /**
     * @param JBBarraDeProgreso the JBBarraDeProgreso to set
     */
    public void setJBBarraDeProgreso(javax.swing.JProgressBar JBBarraDeProgreso) {
        this.JBBarraDeProgreso = JBBarraDeProgreso;
    }
}
//prueba